{% extends "base_jrcadmin1.html" %}

{% block content %}

    <table>
        <tr>
            <td colspan="3"><b>Monthly statistics from CSV file: {{ f.original_name }}</b> ({{ f.import_file.name }})</td>
        </tr>
        {% for item_date, values in ar_complete_stat.items %}
            <tr class="{% cycle "row1" "row2" as rowcolor %}">
                <td rowspan="{{ values.trades|length|add:"1" }}">
                    {{ item_date }}
                </td>
                <td rowspan="{{ values.trades|length|add:"1" }}">
                    {{ values.profit|floatformat:"-5" }}
                </td>
            </tr>
                {% for t in values.trades %}
                    <tr class="{{ rowcolor }}">
                        <td>{{ t.entry_date }}</td>
                        <td>{{ t.entry_price }}</td>
                        <td>{{ t.exit_date }}</td>
                        <td>{{ t.exit_price }}</td>
                        {% if t.get_is_profit %}
                            <td class="profit_trade">{{ t.get_profit|floatformat:"-5" }}</td>
                        {% else %}
                            <td class="non_profit_trade">{{ t.get_profit|floatformat:"-5" }}</td>
                        {% endif %}
                    </tr>
                {% empty %}
                    <tr><td>
                    No in this month
                    </td></tr>
                {% endfor %}
                </td>
        {% empty %}
			<tr>
				<td colspan="3">Error calculating statistic!</td>
			</tr>
        {% endfor %}
    </table>

{% endblock %}
